package org.example.until;

import java.sql.Time;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class GetTime {

    // 获取开始时间的时间戳
    public static Long getStartTime(String startTimeStr) throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date = sdf.parse(startTimeStr);
        long startTimeLong = date.getTime();
        return startTimeLong;
    }

    // 获取结束时间的时间戳
    public static Long getEndTime(String endTimeStr) throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date = sdf.parse(endTimeStr);
        long endTimeLong = date.getTime();
        return endTimeLong;
    }
}
